#!/usr/bin/env node
Slack = require('../')

// omg no var, let or const?! u monster
path = require('path')
repl = require('repl')
chalk = require('chalk')
env = require('node-env-file')

let hasVars = process.env.SLACK_BOT_TOKEN &&
              process.env.SLACK_CLIENT_ID &&
              process.env.SLACK_CLIENT_SECRET
if (!hasVars) {
  // load up the env vars
  env(path.join(__dirname, '..', '.env'))
}

// setup the repl
prompt = chalk.green('#!/slack> ')
server = repl.start({prompt})

// adds some predefined variables
server.context.slack = Slack
server.context.bot = new Slack({token: process.env.SLACK_BOT_TOKEN})
